// bpm sender

MidiIn min;
MidiMsg msg;

0 => int device;

// try to open MIDI port (see chuck --probe for available devices)
if( !min.open( device ) ) me.exit();

// print out device that was opened
<<< "MIDI device:", min.num(), " -> ", min.name() >>>;


// send object
OscSend xmit;
OscSend xmit2;


// aim the transmitter
xmit.setHost( "192.168.178.29", 9999 );
xmit2.setHost( "localhost", 9999 );

0=> int tot;

// infinite time-loop
while( true )
{
    // wait on the event 'min'
    min => now;

    // get the message(s)
    while( min.recv(msg) )
    {
        // print out midi message

        
        if(msg.data2 == 16){
    //    	<<< "e3 axis: " , msg.data3 >>>;
        }
        
        if(msg.data2 == 28){
        	<<< "e3 vel: " , msg.data3 >>>;
        }
        
        if(msg.data2 == 40){
   //     	<<< "e3 angle: " , msg.data3 >>>;
        }
        
        tot + 1 => tot;
        
        if(tot % 48 == 0){
        
        <<< tot, msg.data1, msg.data2, msg.data3 >>>;
        
        xmit.startMsg("/midi/test", "i");
        1 => xmit.addInt;
        
        xmit2.startMsg("/midi/test", "i");
        1 => xmit2.addInt;
        
        }
    }
}


